package com.sixin.web.controller.iot;

import com.sixin.framework.web.base.BaseController;
import com.sixin.common.base.AjaxResult;
import com.sixin.common.page.TableDataInfo;
import com.sixin.iot.domain.Waterpannel;
import com.sixin.iot.service.impl.WaterpannelServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/iot/waterpannel")
public class WaterPannelController extends BaseController {
    private String prefix = "iot/waterpannel";

    @Autowired
    private WaterpannelServiceImpl waterpannelService;
    //private WaterpannelServiceImpl waterpannelServiceImpl;

    @GetMapping()
    public   String water() {
        return prefix + "/waterpannel";
    }

    /**
     * 导出水质监测列表
     */

    @PostMapping ("/view")
    @ResponseBody
    public TableDataInfo List() {
        startPage();
        List<Waterpannel> list =waterpannelService.selectWaterpannelList();
        return getDataTable(list);
    }

    @PostMapping ("/list")
    public String selectListById(Model model,@RequestParam("id") Integer id){
        model.addAttribute("data",waterpannelService.selectListById(id));
        return "iot/waterpannel/wselect";
    }



    @PostMapping ("/delete")
    public String deleteListById(Model model,@RequestParam("id") Integer id){
        model.addAttribute("dedata",waterpannelService.deleteListById(id));
        return "iot/waterpannel/wdelete";
    }


}

